<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">
    <h:head>
        <title>Update Event</title>
    </h:head>
    <h:body>
        <h:form id="updateeventform">
            <p:panel header="Update Event form" style="width: 700px">

                <h:panelGrid columns="3" id="regGrid">

                    <h:outputLabel style="color:black" for="name">Event Name to Change:</h:outputLabel>
                    <p:inputText id="name" value="#{eventbean.namechange}" required="true">
                        <p:ajax update="name"/>
                    </p:inputText>
                    <p:message id="namemsg" for="name" />
                    
                    <h:outputLabel style="color:black" for="dateeventtochange">Date Event to Change:</h:outputLabel>
                    <p:calendar id="dateeventtochange" value="#{eventbean.dateeventtochange}" locale="it" navigator="true" pattern="yyyy-MM-dd HH:mm" required="true">
                    </p:calendar>
                    <p:message id="dateeventtochangemsg" for="dateeventtochange" />
                    
                    <h:outputLabel style="color:black" for="namenew">New Name for Event:</h:outputLabel>
                    <p:inputText id="namenew" value="#{eventbean.event.name}" required="true">
                        <p:ajax update="namenew"/>
                    </p:inputText>
                    <p:message id="namenewmsg" for="namenew" />

                    <h:outputLabel style="color:black" for="location">Location:</h:outputLabel>
                    <p:inputText id="location" value="#{eventbean.event.location}" required="true">
                        <p:ajax update="location"/>
                    </p:inputText>
                    <p:message id="locationmsg" for="location" />

                    <h:outputLabel style="color:black" for="startdate">Start Date:</h:outputLabel>
                    <p:calendar id="startdate" value="#{eventbean.event.startDateTime}" locale="it" navigator="true" pattern="yyyy-MM-dd HH:mm" required="true">
                    </p:calendar>
                    <p:message id="startdatemsg" for="startdate" />

                    <h:outputLabel style="color:black" for="enddate">End Date:</h:outputLabel>
                    <p:calendar id="enddate" value="#{eventbean.event.endDateTime}" locale="it" navigator="true" pattern="yyyy-MM-dd HH:mm" required="true">
                    </p:calendar>
                    <p:message id="enddatemsg" for="enddate" />

                    <h:outputLabel style="color:black" for="status">Status:</h:outputLabel>
                    <h:selectOneMenu id= "status" value="#{eventbean.event.status}" required="true" >
                        <f:selectItem itemValue="Public" itemLabel="Public" />
                        <f:selectItem itemValue="Private" itemLabel="Private" />
                        <p:ajax update="status"/>
                    </h:selectOneMenu>
                    <p:message id="statusmsg" for="status" />

                    <h:outputLabel style="color:black" for="type">Type:</h:outputLabel>
                    <h:selectOneMenu id="type" value="#{eventbean.event.type}" required="true" >
                        <f:selectItem itemValue="Indoor" itemLabel="Indoor" />
                        <f:selectItem itemValue="Outdoor" itemLabel="Outdoor" />
                        <p:ajax update="type"/>
                    </h:selectOneMenu>
                    <p:message id="typemsg" for="type" />


                </h:panelGrid>

                <p:commandButton id="submit" style="background: -webkit-linear-gradient(top, #00b7ea 0%,#009ec3 100%); border: double; border-color: black; border-width: 3px; color: black " value="UpdateEvent" update="regGrid"
                                 action="#{eventbean.updateEvent()}" />
                <p:button style="background: -webkit-linear-gradient(top, #00b7ea 0%,#009ec3 100%); border: double; border-color: black; border-width: 3px; color: black " outcome="calendar" value="Back"/>
            </p:panel>
        </h:form>

    </h:body>
</html>

